<?php declare(strict_types=1);
/**
 * @author      guosir
 * @copyright   2023-2025 owner
 **/

namespace Srv\Apps\Apis\User;

use Srv\Apps\Apis\User\Ctl\ReviewFeedbackCtl;
use Srv\Apps\Proto\DTO\User\ReviewFeedbackListDTO;
use Srv\Apps\Proto\Enum\ErrCodeEnum;
use Srv\Apps\Proto\Enum\LangKeyEnum;
use Srv\Apps\Proto\VO\User\ReviewFeedbackListVO;
use Srv\Libs\ConfModel\RouteConfData;
use Srv\Libs\Frame\ActionAbstract;
use Srv\Libs\Frame\DTOAbstract;
use Srv\Libs\Frame\Lang;
use Srv\Libs\Frame\Page;
use Srv\Libs\Frame\ResponseData;
use Srv\Libs\Frame\VOAbstract;

final class ReviewFeedbackAct extends ActionAbstract
{
    /**
     * @url /review/feedback/list
     * @auth getReviewFeedbackList
     * @req Srv.Apps.Proto.DTO.User.ReviewFeedbackListDTO
     * @rsp Srv.Apps.Proto.VO.User.ReviewFeedbackListVO
     * 反馈记录列表
     */
    public function getReviewFeedbackList(RouteConfData $RouteConfData, ?DTOAbstract $DTOClass, ?VOAbstract $VOClass):bool
    {
        if(!($DTOClass instanceof ReviewFeedbackListDTO) || !($VOClass instanceof ReviewFeedbackListVO)) return ResponseData::rspErrAuto(ErrCodeEnum::ERR_SYS_PARAMS_ERROR, Lang::get(LangKeyEnum::LANG_SYS_PARAMS_ERROR));
        $Page                   = new Page();
        $currPage               = max(1, $DTOClass->getCurrPage());
        $pageSize               = $DTOClass->getPageSize() < 1 ? 12 : $DTOClass->getPageSize();
        $Page->init(0, $pageSize, $currPage);
        $whereData              = $RouteConfData->getParamsResData($DTOClass);
        $VOClass                = ReviewFeedbackCtl::tag()->getReviewFeedbackList($Page, $whereData);
        return ResponseData::rspSuccAuto('', $VOClass);
    }
}